//
//  ButtomSubmitView.m
//  LoveTrail
//
//  Created by giantumbrella on 15/6/25.
//  Copyright (c) 2015年 赵娟. All rights reserved.
//

#import "ButtomSubmitView.h"
#import "CommonMacro.h"

@interface ButtomSubmitView ()
@property (nonatomic,strong) UIView *buttomView;
@property (nonatomic,strong) UILabel *toPriceLabel;
@property (nonatomic,strong) UIButton *submitButton;
@property (nonatomic,strong) UIView *lineView;

@end
@implementation ButtomSubmitView

- (id)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        [self createSubview];
    }
    return self;
}

- (void)createSubview
{
    //3.创建view
    self.buttomView = [[UIView alloc] initWithFrame:CGRectMake(0,0, self.frame.size.width, 50)];
    [self addSubview:self.buttomView];
    
    //那根线
    self.lineView = [[UIView alloc] initWithFrame:CGRectMake(3, 0, self.frame.size.width-6, 3)];
    self.buttomView.layer.borderColor = UIColorWithRGBA(255, 255, 2, 1).CGColor;
    [self.buttomView addSubview:self.lineView];
    
    //实付款
    self.toPriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.buttomView.frame.size.width*0.15, 0, self.buttomView.frame.size.width*0.45, self.buttomView.frame.size.height)];
//    self.toPriceLabel.backgroundColor = [UIColor blueColor];
    self.toPriceLabel.text = @"实付款: 358 元";
    self.toPriceLabel.textColor = UIColorWithRGBA(246, 76, 0, 1);
    self.toPriceLabel.font = [UIFont systemFontOfSize:20];
    [self.buttomView addSubview:self.toPriceLabel];
    
    //结算按钮
    self.submitButton = [[UIButton alloc] initWithFrame:CGRectMake(self.self.toPriceLabel.frame.size.width+self.toPriceLabel.frame.origin.x,11,self.toPriceLabel.frame.size.width*0.89,40)];
    self.submitButton.backgroundColor = [UIColor redColor];
    [self.buttomView addSubview:self.submitButton];
    self.submitButton.layer.cornerRadius = 3;
    self.submitButton.clipsToBounds = YES;
    [self.submitButton setBackgroundColor:UIColorWithRGBA(209, 56, 7, 1)];
    [self.submitButton setTitle:@"提交订单" forState:UIControlStateNormal];
    [self.submitButton addTarget:self action:@selector(buttonClickAction) forControlEvents:UIControlEventTouchUpInside];
}

- (void)buttonClickAction
{
    if ([self.submitDelegate respondsToSelector:@selector(submitOrderButton)]) {
        [self.submitDelegate submitOrderButton];
    }
}

@end
